//
//  EvaluateCell.m
//  carowner
//
//  Created by apple on 2019/5/23.
//  Copyright © 2019 ggj. All rights reserved.
//

#import "EvaluateCell.h"

@implementation EvaluateCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    // Configure the view for the selected state
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        _headImg = [[UIImageView alloc] init];
        _headImg.backgroundColor = gray_color;
        
        _tvName = [[UILabel alloc] init];
        _tvName.font = textFont;
        _tvName.text = @"名称";
        
        _tvTime = [[UILabel alloc] init];
        _tvTime.textColor = tab_unselect_color;
        _tvTime.font = textFont;
        _tvTime.text = @"2010-10-10";
        
        _carImage = [[UIImageView alloc] init];
        _carImage.backgroundColor = gray_color;
        
        _fixStar = [[UILabel alloc] init];
        _fixStar.font = textFont;
        _fixStar.text = @"维修质量评分:";
        
        _serviceStar = [[UILabel alloc] init];
        _serviceStar.font = textFont;
        _serviceStar.text = @"服务态度评分:";
        
        _tvComment = [[UILabel alloc] init];
        _tvComment.font = textFont;
        _tvComment.text = @"评价";
        
        UIView * line = [NSObject getLineView];
        
        [self.contentView addSubview:_headImg];
        [self.contentView addSubview:_tvName];
        [self.contentView addSubview:_tvTime];
        [self.contentView addSubview:_carImage];
        [self.contentView addSubview:_fixStar];
        [self.contentView addSubview:_serviceStar];
        [self.contentView addSubview:_tvComment];
        [self.contentView addSubview:line];
        
        
        [_headImg mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(15);
            make.top.equalTo(self.contentView).offset(10);
            make.size.mas_equalTo(CGSizeMake(50, 50));
        }];
        
        [_tvName mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(_headImg.mas_top).offset(0);
            make.left.equalTo(_headImg.mas_right).offset(6);
        }];
        
        [_tvTime mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(_headImg);
            make.left.equalTo(_headImg.mas_right).offset(6);
        }];
        
        [_carImage mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.contentView).offset(-30);
            make.centerY.equalTo(_headImg);
            make.size.mas_equalTo(CGSizeMake(40, 40));
        }];
        
        [_fixStar mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(_headImg.mas_bottom).offset(10);
            make.left.equalTo(_headImg);
            make.height.mas_equalTo(20);
        }];
        
        [_serviceStar mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(_headImg.mas_bottom).offset(10);
            make.right.equalTo(self.contentView).offset(-30);
            make.height.mas_equalTo(20);
        }];
        
        [_tvComment mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(_fixStar.mas_bottom).offset(10);
            make.left.equalTo(_headImg);
            make.height.mas_equalTo(30);
            make.right.equalTo(self.contentView);
        }];
        
        [line mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(_tvComment.mas_bottom).offset(10);
            make.left.right.equalTo(self.contentView);
            make.bottom.mas_equalTo(self.contentView);
            make.height.mas_equalTo(1);
        }];
        
        
    }
    return self;
}

@end
